/* Teach Tool  - Structural Dynamics
 * Copyright (C) 2009: Fabian Gerold, www.fabiangerold.de
 *
 * This file may be licensed under the terms of of the
 * GNU General Public License Version 3 (the "GPL").
 * 
 * Software distributed under the License is distributed 
 * on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either 
 * express or implied. See the GPL for the specific language 
 * governing rights and limitations.
 *
 * You should have received a copy of the GPL along with this 
 * program. If not, go to http://www.gnu.org/licenses/gpl.html
 * or write to the Free Software Foundation, Inc., 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/

#ifndef ISD_DIAGRAM_H
#define ISD_DIAGRAM_H 1

#include <QtGui>

class System;

class Diagram : public QWidget
{
	Q_OBJECT

public:
	Diagram( System* sys, QWidget *parent = 0 );

	
	
	//void setMax( float u, float up, float upp );
	void showCurves( bool u, bool up, bool upp );
	void totalRepaint();
	

	QSize sizeHint() const;
	QSize minimumSizeHint() const;
	void resizeEvent( QResizeEvent * event );

public slots:
	void slotClearPoints();
	void slotSetMax( float u, float up, float upp );
	void slotUpdate();
	void slotAddPoint( float time, float u, float up, float upp );
	void slotSetScale( float scale );
	void slotSetExcitation( QPainterPath* path, int mode );
	
protected:
	void paintEvent( QPaintEvent* );
	double m_x_min;
	double m_x_max;
	double m_y_min;
	double m_y_max;

private:
	System*	m_system;
	QPixmap*	m_pixmap;
	int		m_numpoints;
	QPointF m_points_u[5000];
	QPointF m_points_up[5000];
	QPointF m_points_upp[5000];
	float	m_time;
	float	m_scale;
	double	m_max_u;
	double	m_max_up;
	double	m_max_upp;
	bool	m_show_u;
	bool	m_show_up;
	bool	m_show_upp;
	QPainter* m_p;
	QPainterPath* m_ex_path;
	int		m_mode;
	int		m_h;

	void paintInit();
};

#endif
